package com.wangzhenyu.learn.test.designPattern

//外观模式


@Suppress("UNUSED")
object KFacadePattern {


    object DVDPlayer {

        fun on() {
            println("DVD ON")
        }


        fun off() {
            println("DVD OFF")
        }

        fun play() {
            println("DVD IS PLAYING")
        }

        fun pause() {
            println("DVD PAUSE")
        }

    }

    object Popcorn {

        fun on() {
            println("Popcorn ON")
        }


        fun off() {
            println("Popcorn OFF")
        }

        fun play() {
            println("Popcorn IS PLAYING")
        }

        fun pause() {
            println("Popcorn PAUSE")
        }
    }

    object Projector {
        fun on() {
            println("Projector ON")
        }


        fun off() {
            println("Projector OFF")
        }

        fun play() {
            println("Projector IS PLAYING")
        }

        fun pause() {
            println("Projector PAUSE")
        }
    }


    class HomeTheaterFacade {


        fun ready() {
            DVDPlayer.on()
            Popcorn.on()
            Projector.on()
        }

        fun play() {
            DVDPlayer.play()
        }

        fun pause() {
            DVDPlayer.pause()
        }

        fun end(){
            DVDPlayer.off()
            Popcorn.off()
            Projector.off()
        }

    }

}